package com.fs.controller.vo.user;

import com.fs.service.bo.user.BoUserInfo;
import com.fs.service.bo.user.BoUserInfoWithRole;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class RespUserWithPermission extends RespUserWithRole {

    private List<Permission> permissions = new ArrayList<>();

    public RespUserWithPermission(BoUserInfo user){
        super(user);
    }

    public RespUserWithPermission(BoUserInfoWithRole user){
        super(user);
    }

    public void addPermission(String target, String action) {
        permissions.add(new Permission(target, action));
    }


}

class Permission {
    Permission(String target, String action) {
        this.target = target;
        this.action = action;
    }

    private String target;
    private String action;

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }
}
